SortAlpha

These functions work off a list style string array element (AM delimited rows, VM delimited values). One performs an alpha based sort and the other will sort by numeric value. If you pass alpha data into the numeric function, it will be converted to zero.

Group:Dynamic Array Extensions


Syntax:

[ListData = ] The data to sort

FieldNo = The field to sort on

Ascending =  The direction of the sort

Return value is the sorted array.

Example:

Dim sList as String

sList = Rep(sList, -1, "9665820393700001WBJ")

sList = Rep(sList, -1, "a665820393700001WBJ")

sList = Rep(sList, -1, "5665820393700001WBJ")

sList = Rep(sList, -1, "c665820393700001WBJ")

sList = Rep(sList, -1, "7665820393700001WBJ")

sList = Rep(sList, -1, "e665820393700001WBJ")

sList = Rep(sList, -1, "3665820393700001WBJ")

sList = Rep(sList, -1, "j665820393700001WBJ")

sList = Rep(sList, -1, "a665820393700001WBJ")

sList = Rep(sList, -1, "8665820393700001WBJ")

sList = Rep(sList, -1, "k665820393700001WBJ")

sList = Rep(sList, -1, "1665820393700001WBJ")

sList = Rep(sList, -1, "z665820393700001WBJ")

sList = Rep(sList, -1, "x665820393700001WBJ")

' because the data is not numeric it won't really sort the list as each value will be treated as zero 'sList = SortNum(sList, 1, True)

'App.ShowList(sList)

' list should be sorted alphabetically.

sList = SortAlpha(sList, 1, True)

App.ShowList(sList)